#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QShowEvent>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    mpPropertyAnimation = new QPropertyAnimation(this);

    mpPropertyAnimation->setDuration(3000);
    mpPropertyAnimation->setPropertyName("palette");

    //mpPropertyAnimation->setEndValue(QRect(0,0,20,161));
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    mpPropertyAnimation->setEndValue(QRect(0,0,20,161));
    mpPropertyAnimation->start();
}


void MainWindow::on_pushButton_2_clicked()
{
    mpPropertyAnimation->setStartValue(QPalette());
    mpPropertyAnimation->setEndValue(QPalette(QColor(0,0,0)));
    mpPropertyAnimation->setLoopCount(2);
    mpPropertyAnimation->start();
}

